/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.bath;

import uk.ac.bath.domains.IP.IPEvaluator;
import uk.ac.bath.domains.IP.IPSetupIF;
import uk.ac.bath.domains.IP.IPSetupQuadVert;
import uk.ac.bath.environment.Evaluator;
import uk.ac.bath.environment.Fitness;
import uk.ac.bath.environment.MachineIF;
import uk.ac.bath.machines.neuralSane.VinillaNeural3Builder;
import uk.ac.bath.schemes.BuilderIF;

/**
 *
 * @author pjl
 */
public class OneShot {

    static IPSetupIF setup = new IPSetupQuadVert();
    static Evaluator eval = new IPEvaluator(setup);
    static int nIn = setup.getNIn();
    static int nHidden = 8;
    static int nOut = setup.getNOut();
    static BuilderIF b = new VinillaNeural3Builder(nIn, nHidden, nOut, false);
    static String strRep;

    static public Fitness eval(String str) {
        MachineIF zzz = b.createMachineFromString(str);
      

        Fitness fit = null;
        eval.setMachine(zzz);
        while (!(fit = eval.tick()).decided()) {
            //System.out.println(eval.getStatus() + fit);
        }
        return fit;


    }

    static public Fitness eval() {
        MachineIF zzz = b.createRandomMachine();
          strRep=b.parametersToString();
        Fitness fit = null;
        eval.setMachine(zzz);

        while (!(fit = eval.tick()).decided()) {
            //System.out.println(eval.getStatus() + fit);
        }
        return fit;
    }

    static public void main(String arg[]){
        eval();
        eval(strRep);


    }

}
